package Test;
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int number=0;
		System.out.println("请输入题目数");
		Scanner scanner= new Scanner(System.in);
		number=scanner.nextInt();
		System.out.println("------------------------");
		String formula;
		String right_answer;
		String get_answer;
		int correct_num=0;
		Function function=new Function();
		DecimalFormat  df = new DecimalFormat("#0.000");  
		while(number!=0){
			while(function.FindSame(formula=function.CreateFormula()));
			System.out.print(formula+"=");
			right_answer=df.format(function.Calculator(formula));
			if(right_answer.equals("∞"))   //出现除0的错误，就重新产生新的式子
				continue;
			get_answer=df.format(function.parseDouble(scanner.next()));
			if(get_answer.equals(right_answer)){
				System.out.println("Right!");
				correct_num++;
			}else{
				System.out.println("Error!");
			}
		    number--;
		}
		System.out.println("------------------------");
		System.out.println("恭喜你做对"+correct_num+"题！");
	}
}


